﻿using System.Net;
using System.Net.Sockets;
using System.Text;

namespace ChatServer
{
	public class ServerInstance
	{
		Socket socketConnect = null;

		public ServerInstance( Socket socketObj)
		{
			socketConnect = socketObj;
		}

		// register event send

		// display message receive

		public void CommunicateClient()
		{

			/*
			 * Send:
			 *	Pack message into Message Object
			 *	Create xml message from Message Object
			 *	send xml message
			 * Receive: xml string
			 *	Parse -> Object Message
			 */


			//byte[] bytes = new byte[256];
			//string bResult = string.Empty;

			//System.Console.WriteLine("Server accept...");

			//instantServe.Send(Encoding.UTF8.GetBytes("Server: Hello"));
			//System.Console.WriteLine("Server send data");

			//instantServe.Receive(bytes);
			//System.Console.WriteLine("Server receive data");

			//instantServe.Close();

			//bResult = Encoding.UTF8.GetString(bytes);
			//System.Console.WriteLine("Server receive Result: " + bResult);
		}
		//response

		//check wit client, if 
	}
}
